<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>会员查询</title>
 	<link href="../resources/css/ligerui-all.css" rel="stylesheet" type="text/css" /> 
 	<link href="../resources/css/ligerui-icons.css" rel="stylesheet" type="text/css" /> 
	<script src="../resources/js/jquery-1.9.1.min.js" type="text/javascript"></script>
	<script src="../resources/js/ligerui.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    	$(function ()
        {
	              window['g'] = $("#isr").ligerGrid({
	                	checkbox: true,
	                    columns: [
	                    { display: '会员编号', name: 'memberNo', width: 100, frozen: true, isSort: false},
	                    { display: '会员姓名', name: 'memberName', width: 100, frozen: true, isSort: false},
	                    { display: '性别', name: 'sex', width: 100, frozen: true, isSort: false},
	                    { display: '会员类型', name: 'clubCardType', width: 100, frozen: true, isSort: false},
	                    { display: '会员积分', name: 'memberPoints', width: 100, frozen: true, isSort: false},
	                    { display: '可用积分', name: 'availableIntegral', width: 100, frozen: true, isSort: false},
	                    { display: '手机电话', name: 'mobile', width: 150, isSort: false },
	    				{ display: '住址', name: 'address', width: 250, isSort: false},
	    				{ display: '注册时间日期', name: 'registrationTime', width: 100,isSort: false },
	    				{ display: '生日日期', name: 'birth', width: 100, isSort: false },
	    				{ display: '是否有效', name: 'active', width: 100, isSort: false },
	    				{ display: '会员备注', name: 'memo', width: 250, isSort: false }
	                    ], //width: 1000,
	                    url : "conditionsList",
	                    width: '99.9%',
	                    pageSizeOptions: [3, 5, 7, 10],
	                    rownumbers:true
	                 });

	              $("form").ligerForm();

	                $("#toolBar").ligerToolBar( {
	                    items : [
									{ text: '增加', click: add,icon:'add' },
									{line: true},
									{ text: '修改', click: update,icon:'edit' },
									{line: true},
									{ text: '删除', click: del, icon: 'busy' },
									{line: true},
									{ text: '导入', click: null, icon: 'back' },
									{line: true},
									{ text: '导出', click: null, icon: 'up' },
									{line: true},
									{ text: '模板下载', click: null, icon: 'attibutes' }
								]
						
	                });

			$("form").ligerForm();

			$("#Button1").click(function() {
				var memberNo = $("#i_memberNo").val();
				var memberName = $("#i_memberName").val();
				var registrationTime = $("#i_registrationTime").val();
				var birth = $("#i_birth").val();
				var url = "conditionsList?memberNo=" + memberNo + "&memberName=" + memberName +
			          "&registrationTime" + registrationTime + "&birth=" + birth;
				$.post("conditionsList", 
						{'memberNo':memberNo, 'memberName':memberName, 'registrationTime':registrationTime, 'birth':birth}
				  , function(data){
						g.loadData(data);
						g.setOptions({'url': url});
					 });
				});
        });

        
        var add = function() {
        	
        	$.ligerDialog.open({ target: $("#add"), width: 650, title: '增加会员信息' });

            };

            var update = function() {
           	 var s = g.getSelectedRows();
           	 if(s.length > 1) {
           		 $.ligerDialog.warn('修改信息不允许多选!');
                }else if(s.length == 0) {
               	 $.ligerDialog.warn('请选择一条记录!');
                }else{
                    $("#update_memberId").val(s[0].memberId);
                    $("#update_memberNo").val(s[0].memberNo);
                    $("#update_memberName").val(s[0].memberName);
                    if(s[0].sex) {
                   	 $("#update_sex").html("<input type='radio' name='sex' value='1' checked='checked'/><label>男</label> <input type='radio' name='sex' value='0'/><label >女</label>");
                        }else {
                       	$("#update_sex").html("<input type='radio' name='sex' value='1'/><label>男</label> <input type='radio' name='sex' value='0'  checked='checked'/><label >女</label>");
                        }
                    if(s[0].active) {
                   	 $("#update_active").html("<input type='radio' name='active' value='1' checked='checked'/><label>是</label> <input type='radio' name='active' value='0'/><label>否</label>");
                        }else {
                         $("#update_active").html("<input type='radio' name='active' value='1' /><label>是</label> <input type='radio' name='active' value='0' checked='checked'/><label>否</label>");
                        }
       
                    $("#update_clubCardType").val(s[0].clubCardType);
                    $("#update_memberPoints").val(s[0].memberPoints);
                    $("#update_birth").val(s[0].birth);
                    $("#update_mobile").val(s[0].mobile);
                    $("#update_registrationTime").val(s[0].registrationTime);
                    $("#update_address").val(s[0].address);
                    $("#update_memo").val(s[0].memo);
           		$.ligerDialog.open({ target: $("#update"), width: 650, title: '修改会员信息' });
                };

              };

        var del = function() {
        	$.ligerDialog.confirm('您真的要删除所选择的信息吗?', function (yes) { 
	              if(yes) {
	        	   var s = g.getSelectedRows();
	        	   var p = new Array();
	        	   for(var i=0; i<s.length; i++) {
	            	   p.push(s[i].memberId);
	               }
	        	   var arrs = JSON.stringify(p);
	        		$.post("/baohua/member/del/" + arrs, function(data){
	            		var mess = eval(data);
	            		  switch (mess)
	                      {
	                          case "success":
	                        	  g.loadData(); 
	                              $.ligerDialog.success('删除成功！');
	                              break;
	                          case "systemerror":
	                              $.ligerDialog.warn('系统出现错误！');
	                              break;
	                          case "error":
	                              $.ligerDialog.error('会员不存在, 不能删除！');
	                              break;
	                      }
	            	}); 
	            	}
        	});
            };
    </script>
    <style type="text/css">
		#isr #toolBar { margin-left:5px;}
    	 .l-table-edit {}
        .l-table-edit-td{ padding:3px;}
        .l-button-submit,.l-button-reset{width:80px; float:left; margin-left:10px; padding-bottom:2px;}
        .l-verify-tip{ left:230px; top:120px;}
    </style>
</head>

<body>
 <!-- 1.导航条 -->
   <span style=" margin: 5px 10px; display: block; font-weight: bold;">宝华茶餐厅 > 会员管理 > 会员查询</span>
 <!-- 2.查询条件 --> 
   <div id="isearch" style="width:100%; margin-bottom: 5px;">
	  <form name="form0" method="post"  id="form0">
        <table cellpadding="0" cellspacing="0" class="l-table-edit" width="100%">
            <tr>
                <td align="right" class="l-table-edit-td" width="11%">会员编号:</td>
                <td align="left" class="l-table-edit-td" style="width:23px"><input name="memberNo" type="text" ltype="text" id="i_memberNo"/></td>
                
                <td align="right" class="l-table-edit-td" width="10%">会员姓名:</td>
                <td align="left" class="l-table-edit-td" style="width:23px"><input name="memberName" type="text" ltype="text" id="i_memberName"/></td>
                
                 <!--  <td align="right" class="l-table-edit-td" width="10%">会员类型:</td>
                 <td align="left" class="l-table-edit-td" style="width:23%"><input name="clubCardType" type="text" ltype="text" id="i_clubCardType"/></td>
                 -->
                <td align="right" class="l-table-edit-td" width="100px">会员类型:</td>
                <td align="left" class="l-table-edit-td" style="width:160px">
                <select name="clubCardType" ltype="select" id="i_clubCardType">
                    <option value="0"> </option>
					<option value="1">临时会员</option>
					<option value="2">普通会员</option>
					<option value="3">高级会员</option>
				</select>
                </td>
            </tr>
           
             <tr>
                <td align="right" class="l-table-edit-td" width="100px">注册日期:</td>
                <td align="left" class="l-table-edit-td" style="width:160px">
                    <input name="registrationTime" type="text" ltype="date" id="i_registrationTime"/>
                </td>
                
                <td align="right" class="l-table-edit-td" width="100px">生日日期:</td>
                <td align="left" class="l-table-edit-td" style="width:160px">
                    <input name="birth" type="text" ltype="date" id="i_birth"/>
                </td>
                
                <td align="right" class="l-table-edit-td" width="100px">是否有效:</td>
                <td align="left" class="l-table-edit-td" style="width:160px">
                   <select name="active"  ltype="select" id="i_active">
	                    <option value="2"> </option>
						<option value="1">是</option>
						<option value="0">否</option>
					</select>
                </td>
            </tr>
            <tr>
                
            </tr>
             <tr>
                 <td colspan="5">&nbsp;</td>
                 <td>
	                 <input type="button" value="查询" id="Button1" class="l-button l-button-submit" /> 
		             <input type="reset" value="重置" class="l-button l-button-reset"/>
		         </td>
            </tr>
        </table>
    </form>
    </div>
 <!-- 3.g工具条 -->  
    <div id="toolBar"></div>
 <!-- 4.会员列表 -->   
	<div id="isr"></div>
 <!-- 5.会员增加信息(弹框) -->	
	<div id="add" style="width:600px; margin:3px; display:none;">
     	<form name="form1" method="post"  id="form1" action="add">
        <table cellpadding="0" cellspacing="0" class="l-table-edit" width="600px">
            <tr>
                <td align="right" class="l-table-edit-td" width="100px">会员编号:</td>
                <td align="left" class="l-table-edit-td" style="width:160px"><input name="memberNo" type="text" ltype="text" id="add_memberNo"/></td>
                <td align="left" width="40px"></td>
                
                <td align="right" class="l-table-edit-td" width="100">会员姓名:</td>
                <td align="left" class="l-table-edit-td" style="width:160px"><input name="memberName" type="text" ltype="text"  id="add_memberName"/></td>
                <td align="left" width="40px"></td>
            </tr>
           
            <tr>
                <td align="right" class="l-table-edit-td" valign="top" width="100px">性别:</td>
                <td align="left" class="l-table-edit-td" style="width:160px">
                    <input type="radio" name="sex" value="1" checked="checked"/><label>男</label> <input type="radio" name="sex" value="0" /><label>女</label>
                </td><td align="left" width="40px"></td>
                
                <td align="right" class="l-table-edit-td" width="100px">会员类型:</td>
                <td align="left" class="l-table-edit-td" style="width:160px">
                <select name="clubCardType" ltype="select" id="add_clubCardType">
					<option value="1"></option>
					<option value="2">临时会员</option>
					<option value="3">普通会员</option>
					<option value="4">高级会员</option>
				</select>
                </td>
                <td align="left" width="40px"></td>
            </tr>   
             <tr>
                <td align="right" class="l-table-edit-td" width="100px">会员积分:</td>
                <td align="left" class="l-table-edit-td" style="width:160px"><input name="memberPoints" type="text" ltype="text" id="add_memberPoints"/></td>
                <td align="left" width="40px"></td>
                
                <td align="right" class="l-table-edit-td" width="100px">生日日期:</td>
                <td align="left" class="l-table-edit-td" style="width:160px">
                    <input name="add_birth" type="text" ltype="date" id="add_birth"/>
                </td>
                <td align="left" width="40px"></td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td" width="100px">手机号码:</td>
                <td align="left" class="l-table-edit-td" style="width:160px"><input name="mobile" type="text" ltype="text" id="add_mobile"/></td>
                <td align="left" width="40px"></td>
                
                <td align="right" class="l-table-edit-td" width="100px">注册日期:</td>
                <td align="left" class="l-table-edit-td" style="width:160px">
                    <input name="add_registrationTime" type="text" ltype="date" id="add_registrationTime"/>
                </td>
                <td align="left" width="40px"></td>
            </tr>
            <tr>
                
               <td align="right" class="l-table-edit-td" valign="top" width="100px">是否有效:</td>
                <td align="left" class="l-table-edit-td" style="width:160px">
                    <input name="active" type="radio"  value="1" checked="checked"/><label>是</label> <input type="radio" name="active" value="0" /><label>否</label>
                </td>
                <td align="left" width="40px"></td>
            </tr>
            
              <tr>
                <td align="right" class="l-table-edit-td" width="100px">住址:</td>
                <td align="left" class="l-table-edit-td"  colspan="4" width="460px">
                	<textarea cols="20" rows="1" class="l-textarea" style="width:460px" name="address"></textarea>
                </td>
                <td align="left" width="40px"></td>
            </tr> 
                 
            <tr>
                <td align="right" class="l-table-edit-td" width="100px">备注:</td>
                <td align="left" class="l-table-edit-td" colspan="4"> 
                <textarea cols="100" rows="4" class="l-textarea" style="width:460px" name="memo"></textarea>
                </td>
                <td align="left" width="40px"></td>
            </tr>
            
            <tr>
               <td colspan="4">&nbsp;</td>
               <td align="right">
                  <input type="submit" value="提交" id="Button1" class="l-button l-button-submit" /> 
				  <input type="reset" value="重置" class="l-button l-button-reset"/>
               </td>
                <td align="left" width="40px"></td>
            </tr>
        </table>
 	<br />
    </form>
    </div>
 <!-- 会员修改信息(弹框) -->   
    <div id="update" style="width:600px; margin:3px; display:none;">
     	<form name="form2" method="post"  id="form2" action="update">
        <table cellpadding="0" cellspacing="0" class="l-table-edit" width="600px">
            <tr>
                <td align="right" class="l-table-edit-td" width="100px">会员编号:</td>
                <td align="left" class="l-table-edit-td" style="width:160px">
                   <input name="memberNo" type="text" ltype="text" id="update_memberNo"/>
                   <input name="update_memberId" type="hidden" ltype="text" id="update_memberId"/>
                   <input name="clubCardType" type="hidden" ltype="text" id="update_clubCardType"/>
                </td>
                <td align="left" width="40px"></td>
                
                <td align="right" class="l-table-edit-td" width="100">会员姓名:</td>
                <td align="left" class="l-table-edit-td" style="width:160px"><input name="memberName" type="text" ltype="text" id="update_memberName"/></td>
                <td align="left" width="40px"></td>
            </tr>
           
            <tr>
                <td align="right" class="l-table-edit-td" valign="top" width="100px">性别:</td>
                <td align="left" class="l-table-edit-td" style="width:160px" id="update_sex">
                </td><td align="left" width="40px"></td>
                
                <td align="right" class="l-table-edit-td" width="100px">会员类型:</td>
                <td align="left" class="l-table-edit-td" style="width:160px">
                <select name="clubCardType" ltype="select" id="update_clubCardType">
					<option value="1"></option>
					<option value="2">临时会员</option>
					<option value="3">普通会员</option>
					<option value="4">高级会员</option>
				</select>
                </td>
                <td align="left" width="40px"></td>
            </tr>   
             <tr>
                <td align="right" class="l-table-edit-td" width="100px">会员积分:</td>
                <td align="left" class="l-table-edit-td" style="width:160px"><input name="memberPoints" type="text" ltype="text" id="update_memberPoints"/></td>
                <td align="left" width="40px"></td>
                
                <td align="right" class="l-table-edit-td" width="100px">生日日期:</td>
                <td align="left" class="l-table-edit-td" style="width:160px">
                    <input name="update_birth" type="text" ltype="date" id="update_birth"/>
                </td>
                <td align="left" width="40px"></td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td" width="100px">手机号码:</td>
                <td align="left" class="l-table-edit-td" style="width:160px"><input name="mobile" type="text" ltype="text" id="update_mobile"/></td>
                <td align="left" width="40px"></td>
                
                <td align="right" class="l-table-edit-td" width="100px">注册日期:</td>
                <td align="left" class="l-table-edit-td" style="width:160px">
                    <input name="update_registrationTime" type="text" ltype="date" id="update_registrationTime"/>
                </td>
                <td align="left" width="40px"></td>
            </tr>
           
            <tr>
               <td align="right" class="l-table-edit-td" valign="top" width="100px">是否有效:</td>
                <td align="left" class="l-table-edit-td" style="width:160px" id="update_active">
                </td>
                <td align="left" width="40px"></td>
                <td align="right" class="l-table-edit-td" valign="top" width="100px"></td>
                <td align="left" class="l-table-edit-td" style="width:160px">
                </td>
                <td align="left" width="40px"></td>
            </tr>
            
              <tr>
                <td align="right" class="l-table-edit-td" width="100px">住址:</td>
                <td align="left" class="l-table-edit-td"  colspan="4" width="460px">
                	<textarea cols="20" rows="1" class="l-textarea" style="width:460px" name="address" id="update_address"></textarea>
                </td>
                <td align="left" width="40px"></td>
            </tr> 
                 
            <tr>
                <td align="right" class="l-table-edit-td" width="100px">备注:</td>
                <td align="left" class="l-table-edit-td" colspan="4"> 
                <textarea cols="100" rows="4" class="l-textarea" style="width:460px" name="memo" id="update_memo"></textarea>
                </td>
                <td align="left" width="40px"></td>
            </tr>
            
             <tr>
               <td colspan="4">&nbsp;</td>
               <td align="right">
                  <input type="submit" value="提交" id="Button1" class="l-button l-button-submit" /> 
				  <input type="reset" value="重置" class="l-button l-button-reset"/>
               </td>
                <td align="left" width="40px"></td>
            </tr>
        </table>
 	<br />
    </form>
    </div>
    
    <div>
     <form name="form3" method="post"  id="form3">
        <table cellpadding="0" cellspacing="0" class="l-table-edit" >
     	 <tr>
                <td align="right" class="l-table-edit-td">名字:</td>
                <td align="left" class="l-table-edit-td" style="width:160px"><input name="txtName" type="text" id="txtName" ltype="text" validate="{required:true,minlength:3,maxlength:10}" /></td>
                <td align="left"></td>
            </tr>
         </table>
       </form>
    </div>
</body>

</html>